package com.zbdx.dao.impl;

import com.zbdx.dao.ShoppingGoodsDao;
import com.zbdx.domain.product;
import com.zbdx.util.DruidUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

/**
 * @version 1.0
 * @Auther 樊航宇
 * @Date 2024/9/16 16:15
 * @注释
 */
public class shoppingGoodsDaoImpl implements ShoppingGoodsDao {

   private QueryRunner qr = new QueryRunner(DruidUtil.getDataSource());

   @Override
   public product selectById(int pid) throws SQLException {

      String sql = "select * from product where pid = ?";

      product product = qr.query(sql,new BeanHandler<com.zbdx.domain.product>(com.zbdx.domain.product.class),pid);

      return product;
   }
}
